package com.gdust.spzx.common.exception;

import com.gdust.hzx.model.vo.common.ResultCodeEnum;
import lombok.Data;

/**
 * ClassName: GdustException
 * Package: com.gdust.spzx.common.exception
 * Description:自定义异常配置类
 *
 * @Author syun
 * @Create 2024/11/2 23:28
 * @Version 1.0
 */
@Data
public class GdustException extends RuntimeException{
    private Integer code;// 错误状态码
    private String message;// 错误消息
    private ResultCodeEnum resultCodeEnum;// 封装错误状态码和错误消息

    /**
     * 自定义异常构造器
     * @param resultCodeEnum 封装错误状态码和错误消息
     */
    public GdustException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }
}
